import {
  observable,
  action
} from "mobx-miniprogram";
import {
  getStorage
} from "../utils/store"
export const store = observable({
  // 数据字段
  token: getStorage("token") || "",
  userinfo: getStorage("userinfo") || {},
  // 计算属性
  get sum() {},
  // actions
  setToken: action(function (token) {
    this.token = token
  }),
  setUserInfo: action(function (image, name) {
    this.userinfo.avatarUrl = image
    this.userinfo.nickName = name
  })
});